package compare;

import org.junit.Test;

import java.util.Arrays;

/**
 * 自然排序  Comparable
 */
public class ComparableTest {
    @Test
    public void test1() {
        Product[] products = new Product[5];

        products[0] = new Product("Xiaomi", 3289);
        products[1] = new Product("Huawei", 5699);
        products[2] = new Product("iPhone", 8099);
        products[3] = new Product("HuaweiMate50", 5699);
        products[4] = new Product("OPPO", 3699);

        Arrays.sort(products);
        for (Product p :
                products) {
            System.out.println(p);
        }
    }

}
